package com.baizhi.buff;

import java.io.*;

/**
 * 用缓冲字节流拷贝视频并测试效率
 */
public class BufferCopy {
    public static void main(String[] args) throws IOException {

        long start = System.currentTimeMillis();

        FileInputStream fis = new FileInputStream("G:/java笔记/day16/5月9日pm.mp4");
        BufferedInputStream bis = new BufferedInputStream(fis);


        FileOutputStream fos = new FileOutputStream("./javase_io/视频.mp4");
        BufferedOutputStream bos = new BufferedOutputStream(fos);


        int d;
        while((d = bis.read())!=-1){
            bos.write(d);
        }

        bos.close();
        bis.close();

        long end = System.currentTimeMillis();

        System.out.println("复制完毕，耗时："+(end-start)+ "ms");
    }
}
